package test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
//import org.apache.commons.io.FilenameUtils;
import org.junit.Test;
//import static org.junit.Assert.*;
import module.JdkZipCompressModule;

public class JdkZipTest{
	private JdkZipCompressModule zipModule = new JdkZipCompressModule ();
	@Test 
	public void compress() throws Exception{
		String inputFileName1 = "c:\\TestCompress\\f.txt";
		String inputFileName2 = "c:\\TestCompress\\g.txt";
		String outputFileName = "c:\\TestCompress\\test.zip";
		List<File> srcFiles = new ArrayList<File>();
		File srcFile1 = new File(inputFileName1);
		File srcFile2 = new File(inputFileName2);
		srcFiles.add(srcFile1); 
		srcFiles.add(srcFile2);
		File destFile = new File(outputFileName);

		zipModule.doCompress(srcFiles, destFile);
	}
	
	@Test
	public void decompress() throws Exception{
		String inputFileName = "c:\\TestCompress\\5666E582-0DF1-2B83-D49C-74A3AB7B7B93_FVDaten.SGOAblegen.0605.zip";
		String outputDir = inputFileName.substring(0, inputFileName.lastIndexOf("."));
		File srcFile = new File(inputFileName);

		new File(outputDir).mkdirs();
		File destDir = new File(outputDir);
		
		zipModule.doDecompress(srcFile, destDir);
	}
}
